package com.qcs.ando.manage;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class ContextManager extends Manager {

    public ContextManager(Context context) {
        super(context);
    }

    /**
     * �� nowView �е��� newView����� bund ��Ϊ null���� bund ���ݸ� newView�� �� newView
     * �޷����ظ� nowView ����ݣ����ڵ�����ݴ���
     * 
     * @param newView
     *            ���õ� Activity �� Class
     * @param bund
     *            ��Ҫ���ݵ� Bundle�����Ϊ null���򴫵ݹ�ϵ�����ڡ�
     * @param canBack
     *            �Ƿ�ر� nowView��true�����رգ�false���ر�
     */
    public void goToOtherActivity(Class<?> newView, Bundle bund, boolean canBack) {
        // new һ�� Intent ���󣬲�ָ��Ҫ���������ã��� class
        Intent intent = new Intent();
        intent.setClass(mContext, newView);

        if (bund != null) {
            intent.putExtras(bund);
        }

        // ����һ���µ� Activity
        mContext.startActivity(intent);
        if (!canBack) {
            // �ر�ԭ���� Activity
            ((Activity) mContext).finish();
        }
    }

}
